package dm1101.demo01;

/**
 * @author Ln
 * @version 终极版
 * @date 2022/11/1 14:38
 */
public class TestYield {
    public static void main(String[] args) {
        Yield yield = new Yield();
        Yield yield1 = new Yield();
        yield.start();
        yield1.start();

    }
}
class Yield extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            Thread.yield();
            System.out.println(Thread.currentThread().getName()+"====="+i);
        }
    }
}
